Ash and Brock are playing a game with their Pokémon. Each time a player is allowed to pick 1, 2 or 4 Pokeballs from a bag filled with all their Pokeballs, and the player that gets the last Pokeball is the winner. Assume that both players are extremely intelligent(of course this is overstating things a bit for Ash) and he will try his best to work out a winning strategy. For example, if there are 2 Pokeballs and Ash is the first player to pick, he will certainly pick 2 Pokeballs and win. If there are 3 Pokeballs and Ash is still the first player to pick, no matter if he picks 1 or 2 Pokeballs, Brock will get the last Pokeball and win the game. Given the number of Pokeballs and the order the players will choose in you are required to determine the victor, and calculate how many different strategies there are for him to win the game. You can assume that there are no more than 30 Pokeballs.
Input Format
You are given the order the players will move in and the number of Pokeballs in the bag. Ash and Brock's names will be spelled the way they are in the sample input.
Sample Input
3 ash brock
Output Format The name of the winner followed by a space and the number of ways they could win.
Sample Output
brock 2
You must be logged in to submit a solution.